﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Globalization;
using ulement.Web;
using System.Web.UI;

/// <summary>
/// Summary description for LinkHelper
/// </summary>
public class LinkHelper
{
    public LinkHelper()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    

    //public static string LinkLoaiSanPhamCon(object loaisanphamID)
    //{

    //    LoaiSanPhamHelper lspHP = new LoaiSanPhamHelper();
    //    LoaiSanPhamDataSet lspDS = lspHP.LoadLoaiSanPham(Convert.ToInt32(loaisanphamID));
    //    if (lspDS.LoaiSanPham.Rows.Count > 0)
    //    {
    //        LoaiSanPhamDataSet.LoaiSanPhamRow loaisp = lspDS.LoaiSanPham[0];
    //        return UIPage.AppPath + "ListItem.aspx?type=con&id=" + loaisanphamID;
    //    }
    //    return "";
    //}

    //public static string LinkAdminLoaiSanPhamCha(object loaisanphamID)
    //{

    //    LoaiSanPhamHelper lspHP = new LoaiSanPhamHelper();
    //    LoaiSanPhamDataSet lspDS = lspHP.LoadLoaiSanPham(Convert.ToInt32(loaisanphamID));
    //    if (lspDS.LoaiSanPham.Rows.Count > 0)
    //    {
    //        LoaiSanPhamDataSet.LoaiSanPhamRow loaisp = lspDS.LoaiSanPham[0];

    //        return "QuanLySanPham.aspx?id=" + loaisp.LoaiSanPhamID + ".html";
    //    }
    //    return "";
    //}

    //public static string LinkAdminLoaiSanPhamCon(object loaisanphamID)
    //{

    //    LoaiSanPhamHelper lspHP = new LoaiSanPhamHelper();
    //    LoaiSanPhamDataSet lspDS = lspHP.LoadLoaiSanPham(Convert.ToInt32(loaisanphamID));
    //    if (lspDS.LoaiSanPham.Rows.Count > 0)
    //    {
    //        LoaiSanPhamDataSet.LoaiSanPhamRow loaisp = lspDS.LoaiSanPham[0];
    //        return "QuanLySanPham.aspx?id=" + loaisp.LoaiSanPhamID;
    //    }
    //    return "";
    //}

    public static string GetLinkHinhAnh(object hinhanh)
    {
        if (hinhanh == DBNull.Value || hinhanh=="")
        {
            hinhanh = "img1.jpg";
        }
        return UIPage.AppPath + "/images/" + hinhanh;
    }

    public static string GetLinkCss(object css)
    {
        return UIPage.AppPath + "/Css/" + css;
    }

    public static string GetLinkJs(object js)
    {
        return UIPage.AppPath + "/js/" + js;
    }

    //public static string LinkSanPham(object sanphamID)
    //{

    //    SanPhamHelper spHP = new SanPhamHelper();
    //    SanPhamDataSet spDS = spHP.LoadSanPham(Convert.ToInt32(sanphamID));
    //    if (spDS.SanPham.Rows.Count > 0)
    //    {
    //        SanPhamDataSet.SanPhamRow sp = spDS.SanPham[0];
    //        return UIPage.AppPath + "Detail.aspx?id=" + sanphamID + "&loaisanpham=" + sp.LoaiSanPham;
    //        //return LinkLoaiSanPhamCon(sp.LoaiSanPham).Replace(".html","") + "/" + URLRewrite.ConvertToUnSign(sp.TenSanPham) + "_" + sp.SanPhamID + ".html";
    //    }
    //    return "";
    //}

    //public static string LinkAdminSanPham(object sanphamID)
    //{

    //    SanPhamHelper spHP = new SanPhamHelper();
    //    SanPhamDataSet spDS = spHP.LoadSanPham(Convert.ToInt32(sanphamID));
    //    if (spDS.SanPham.Rows.Count > 0)
    //    {
    //        SanPhamDataSet.SanPhamRow sp = spDS.SanPham[0];

    //        return "ChiTietSanPham.aspx?mode=edit&id=" + sp.SanPhamID;
    //    }
    //    return "";
    //}

    public static string FormatMoney(int money)
    {
        return String.Format("{0:#,###}", money) + " VNĐ";
        //return String.Format(CultureInfo.CreateSpecificCulture("vi-VN"), "{0:C}", money);
    }

    public static string GetAdminLinkCss(object css)
    {
        return UIPage.AppPath + "/admin/resources/css/" + css;
    }

    public static string GetAdminLinkJs(object js)
    {
        return UIPage.AppPath + "/admin/resources/scripts/" + js;
    }

    //public static string LinkAdminBanner(object sanphamID)
    //{



    //    return "ChiTietBanner.aspx?mode=edit&id=" + sanphamID;
        
    //}

    //public static string LinkAdminDoiTac(object sanphamID)
    //{
    //    return "ChiTietDoiTac.aspx?mode=edit&id=" + sanphamID;
    //}

    //public static string LinkAdminTinTuc(object sanphamID)
    //{
    //    return "ChiTietTinTuc.aspx?mode=edit&id=" + sanphamID;
    //}

    //public static string LinkTinTuc(object sanphamID)
    //{
    //    TinTucDataSet tintucDs = new TinTucHelper().LoadTinTuc(Convert.ToInt32(sanphamID));
    //    return UIPage.AppPath + "ChiTietTinTuc.aspx?id=" + sanphamID;
    //}

    //public static string LinkAdminLoaiSanPham(object sanphamID)
    //{
    //    return "ChiTietLoaiSanPham.aspx?mode=edit&id=" + sanphamID;
    //}

    //public static string LinkAdminHTTT(object sanphamID)
    //{
    //    return "ChiTietHTTT.aspx?mode=edit&id=" + sanphamID;
    //}

    //public static string LinkAdminHinhAnhSP(object hinhanhID,object sanphamID)
    //{
    //    return "ChiTietHinhAnhSanPham.aspx?mode=edit&id=" + hinhanhID+"&sanphamid="+sanphamID;
    //}
}